Submit-Reset

Description

A pair of buttons for submitting data to the server and resetting modified controls back to their original values.

Discussion

The Submit-Reset Defined Control is a button to submit the UX component control data to the server and another to reset the UX component controls to their original state. The buttons contain code in the click event to perform the action as well as an enable expression. The buttons are only enabled if one or more controls have been modified (i.e. the UX component becomes "dirty".)

Choosing an Enable Expression

If the UX Component is data bound, you will be prompted to choose when the Submit and Reset buttons should be enabled:

  • When any control on the UX component is dirty
  • When a control that is bound to a table is dirty

If you select When any control on the UX component is dirty, the Submit and Rest buttons will be enabled if any control's value is modified. This includes both data bound and unbound controls.

If you select When a control that is bound to a table is dirty, the Submit and Reset buttons will only be enabled when the value is changed for a control that data bound. If your UX component contains data controls that are not bound to a table, such as a List control or controls used to do a search, selecting When a control that is bound to a table is dirty is recommended.

Updating an Existing Enable Expression to only Enable when a Control Bound to a Table is Dirty

The UX component includes several system fields you can use in an enable expression to check the component's dirty state. If you're not prompted to choose an enable expression, the Submit and Reset buttons will be enabled when any control in the UX Component is modified. This is done by checking the dialog.isDirty variable:

dialog.isDirty = true

You can change the Enable expression to only enable the buttons when data bound controls are modified by checking the dialog.isDataDirty variable. For example:

dialog.isDataDirty = true

The Enable expression can be changed to enable the Submit and Reset buttons using whatever test you need. See Enable expression to learn more.

Videos

Submitting Data in a UX Component

This video shows how you can put a Submit button on the UX Component to submit the data to the server, what happens when the Submit button is pressed, and a brief overview of the AfterDialogValidate server-side event. The AfterDialogValidate event is typically used to save the submitted data to a table. You are free to write your own code to perform this task, or you can use Server-side Action Scripting to write the code for you.